package cn.mst.vrs.dal.mysql.venuetype;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.mst.vrs.controller.admin.venuetype.vo.VenueTypePageReqVO;
import cn.mst.vrs.dal.dataobject.venuetype.VenueTypeDO;
import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 体育场地类型 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface VenueTypeMapper extends BaseMapperX<VenueTypeDO> {

    default PageResult<VenueTypeDO> selectPage(VenueTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VenueTypeDO>()
                .eqIfPresent(VenueTypeDO::getCode, reqVO.getCode())
                .likeIfPresent(VenueTypeDO::getName, reqVO.getName())
                .eqIfPresent(VenueTypeDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(VenueTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VenueTypeDO::getId));
    }

    default List<VenueTypeDO> selectDictList(){
        return ChainWrappers.lambdaQueryChain(this)
                .select(VenueTypeDO::getId,VenueTypeDO::getName)
                .list();
    }
}